import fs from "fs";
import path from "path";

const typesDir = path.resolve(__dirname, "./types");
const indexFile = path.join(typesDir, "index.ts");

function generateExports() {
  const files = fs
    .readdirSync(typesDir)
    .filter((file) => file !== "index.ts" && file.endsWith(".ts"));

  const exports = files.map((file) => `export * from './${file.replace(".ts", "")}';`).join("\n");

  fs.writeFileSync(indexFile, exports, "utf-8");
}

export default generateExports;
